<?php
    include_once('user.php');
    // 启用session，解决全局登录的问题
    session_start();

    if (!User::isLogin()) {
        header('Location: login.view.php');
    }

    // 获取当前登录的用户姓名
    $user = User::getCurrentLoginUser();
    $title = '首页';
    include('head.php');
?>
<body>
    <div class="contanier">
        <div class="row mt-5">
            <div class="col-12 text-right pr-5">
                <a href="logout.controller.php" class="btn btn-outline-warning">注销</a>
            </div>
            <div class="col-12">
                <h2 class="text-success text-center">登录成功: <?php echo $user['name']; ?></h2>
            </div>
        </div>
    </div>
</body>
</html>